<template>
	<view>
		<view class="inputs_info">
			<view class="ipt">
				<input confirm-type="search" class="inputs" type="text" v-model="text" placeholder="大家都在搜" />
				<uni-icons type="search" size="24" color="#888888"></uni-icons>
			</view>
		</view>
		<swipergo :swiperid="swiperid1" :upHeight="300" :upWith="716"></swipergo>
		<view class="content">
			<view class="c_flex" v-for="(item,index) in textlist" :key="index" @click="goPage">
				<view class="ts1" v-if="item.text1">
					{{item.text1}}
					<span v-if="item.text1.length < 23" class="ts2s">{{item.createTime.substr(0,10)}}</span>
				</view>
				<view class="ts2_flex" v-if="item.text2">
					<view class="ts2">
						{{item.text2}}
					</view>
					<span class="ts2s">{{item.createTime.substr(0,10)}}</span>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getNotice
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				swiperid1: 6,
				textlist: []
			};
		},
		onLoad() {
			let that = this
			getNotice({}).then(res => {
				if (res.code == 200) {
					res.rows.forEach(item => {
						item.text1 = item.title.slice(0, 23)
						item.text2 = item.title.slice(23)
						item.ishow = true
					})
					that.textlist = res.rows
				}
			})
		},
		methods: {
			goPage() {
				uni.navigateTo({
					url: '/pages/my/noticeinfo'
				})
			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: #F0F0F1;
	}

	.content {
		background-color: #fff;
		width: 716rpx;
		margin: 0rpx auto;
		border-radius: 10rpx;
		padding: 30rpx 24rpx;
		box-sizing: border-box;

		.c_flex {
			border-bottom: 1px solid #eee;
			padding: 20rpx 0rpx;
			font-size: 28rpx;
			line-height: 44rpx;

			.ts1 {
				font-size: 28rpx;
				display: flex;
				justify-content: space-between;
			}

			.ts2_flex {
				display: flex;
				justify-content: space-between;
				align-items: center;
			}

			.ts2s {
				font-size: 28rpx;
			}

			.ts2 {
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
	}
</style>